package listbyorder.access101_200.test121;

/**
 * @author code_yc
 * @version 1.0
 * @date 2020/6/8 13:06
 */
public class Solution1 {

    // 方法一： 暴力解法
    public int maxProfit(int[] prices) {
        int ans = 0;
        for (int i = 0; i < prices.length - 1; i++) {
            for (int j = i + 1; j < prices.length; j++) {
                if (prices[j] - prices[i] > ans) {
                    ans = prices[j] - prices[i];
                }
            }
        }
        return ans;
    }

}
